<!DOCTYPE HTML>
<html lang="zxx">

<head>
	<title>MyHouse公寓后台-登录</title>
	<!-- Meta tag Keywords -->
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta charset="UTF-8" />
	<meta name="keywords" content="Triple Forms Responsive Widget,Login form widgets, Sign up Web forms , Login signup Responsive web form,Flat Pricing table,Flat Drop downs,Registration Forms,News letter Forms,Elements" />
	<script>
		addEventListener("load", function () {
			setTimeout(hideURLbar, 0);
		}, false);

		function hideURLbar() {
			window.scrollTo(0, 1);
		}
	</script>
	<!-- Meta tag Keywords -->

	<!-- css files -->
	<link rel="stylesheet" href="house_css/style.css" type="text/css" media="all" />
	<!-- Style-CSS -->
	<link href="house_css/font-awesome.min.css" rel="stylesheet">
	<link href="/xtiper_css/xtiper.css" rel="stylesheet" type="text/css"/>
	<!-- Font-Awesome-Icons-CSS -->
	<!-- //css files -->

</head>

<body>
	<div class="main-bg" id="mian">
		<!-- title -->
		<h1>MyHouse公寓后台管理系统</h1>
		<!-- //title -->
		<div class="sub-main-w3">
			<div class="image-style">

			</div>
			<!-- vertical tabs -->
			<div class="vertical-tab">
				<div id="section1" class="section-w3ls">
					<input type="radio" name="sections" id="option1" checked>
					<label for="option1" class="icon-left-w3pvt"><span class="fa fa-user-circle" aria-hidden="true"></span>登录</label>
					<article>
						<form action="#" method="post">
							<h3 class="legend">账号登录</h3>
							<div class="input">
								<span class="fa fa-user-o" aria-hidden="true"></span>
								<input type="email" v-model="logindata.email" placeholder="用户名" name="email" required />
							</div>
							<div class="input">
								<span class="fa fa-key" aria-hidden="true"></span>
								<input type="password" v-model="logindata.password" placeholder="密码" name="password" required />
							</div>
							<button type="button" class="btn submit" @click="login()">登 录</button>
							<a @click="forget()" class="bottom-text-w3ls">忘记密码?</a>
						</form>
					</article>
				</div>
				<div id="section2" class="section-w3ls">
					<input type="radio" name="sections" id="option2">
					<label for="option2" class="icon-left-w3pvt"><span class="fa fa-pencil-square" aria-hidden="true"></span>注册</label>
					<article>
						<form action="#" method="post">
							<h3 class="legend">注册帐户</h3>
							<div class="input">
								<span class="fa fa-user-o" aria-hidden="true"></span>
								<input type="text" v-model="houseregist.houseid"  placeholder="公寓编号" name="" required />
							</div>
							<div class="input">
								<span class="fa fa-user-o" aria-hidden="true"></span>
								<input type="text" v-model="houseregist.name"  placeholder="管理员姓名" name="" required />
							</div>
							<div class="input">
								<span class="fa fa-key" aria-hidden="true"></span>
								<input type="text" v-model="houseregist.username"  placeholder="注册帐号" name="" required />
							</div>
							<div class="input">
								<span class="fa fa-key" aria-hidden="true"></span>
								<input type="password" v-model="houseregist.password"  placeholder="注册密码" name="" required />
							</div>
							<button type="button"  class="btn submit" @click="regist()">注 册</button>
						</form>
					</article>
				</div>
				<div id="section3" class="section-w3ls">
					<input type="radio" name="sections" id="option3">
					<label for="option3" class="icon-left-w3pvt"><span class="fa fa-lock" aria-hidden="true"></span>忘记密码?</label>
					<article>
						<form action="#" method="post">
							<h3 class="legend last">重置密码</h3>
							<p class="para-style">请在下面输入您的电子邮件地址，我们将给您发送一封带有说明的电子邮件。</p>
							<p class="para-style-2"><strong>MyHouse</strong>与您携手同行 <a href="#"></a></p>
							<div class="input">
								<span class="fa fa-envelope-o" aria-hidden="true"></span>
								<input type="email" v-model="forgetdata.email" placeholder="邮箱" name="email" required />
							</div>
							<button type="button" @click="submitForget()" class="btn submit last-btn">提交</button>
						</form>
					</article>
				</div>
			</div>
			<!-- //vertical tabs -->
			<div class="clear"></div>
		</div>
		<!-- copyright -->
		<div class="copyright">
			<h2>Copyright &copy; 2019 - {{nowYear}} 版权所有| by
				<a href="#">ChanKwongwing</a>
			</h2>
		</div>
		<!-- //copyright -->
	</div>

</body>
<!-- script   -->
<script src="https://www.jq22.com/jquery/vue.min.js"></script>
<script src="/webjars/axios/0.19.0/dist/axios.min.js"></script>
<script src="/xtiper_js/xtiper.js"></script>
<script src="/configjs/config.js"></script>
<!-- JavaScript 代码需要放在尾部（指定的HTML元素之后） -->
<script>
new Vue({
    el:'#mian',
    data: {
        nowYear:new Date().getFullYear(),
        logindata:{
				email:"",
				password:""
			},
			registerdata:{
				name:"",
				password:"",
				confirmPassword:""
			},
			forgetdata:{
				email:"",
			},
		houseregist:{
        	username:"",
			password:"",
			houseid:"",
			name:""
		}
    },
	methods:{
    	login:function () {

			if (this.logindata.password==""||this.logindata.email==""){
				xtip.msg("帐号或密码不能为空")
			}else{
				loadid=xtip.load('正在验证帐号密码...请耐心等待');
				axios.get(link+"house/login",{params:{username:this.logindata.email,password:this.logindata.password}}).then(
						res=>{
							if (res.data.data=="faild"){
								xtip.close(loadid);
								xtip.msg("登录失败,请检查帐号密码是否正确","e");
							}else{
								xtip.close(loadid);
								if (res.data.data=="stateno"){
									xtip.alert("帐号尚未激活,请咨询管理员审核通过后方可正常登录",'e');
								}else{
									xtip.msg("登录成功,正在处理请等待...","s");
									window.location.href="house_main.html?&myhouse1.0&"+window.btoa(window.encodeURIComponent(this.logindata.email));
								}


							}
						}
				)
			}
		},
		regist:function () {
    		if (this.houseregist.houseid==""||this.houseregist.password==""||this.houseregist.username==""||this.houseregist.name==""){
    			xtip.msg("请检查数据填写的完整性!")
			}else{
				loadid=xtip.load("正在处理");
				axios.post(link+"house/manageregist",this.houseregist).then(res=>{
					if (res.data.data=="success"){
						xtip.close(loadid);
						xtip.msg("注册成功!请等待公寓管理员审核",{icon:"s"});
					}else{
						xtip.close(loadid);
						xtip.msg("注册失败,"+res.data.data,{icon:"e"});
					}
				})
			}
		},
		submitForget:function () {
			loadid=xtip.load("正在处理");
			axios.get(link+"house/forget",{params:{email:this.forgetdata.email}}).then(res=>{
				if (res.data.data=="success"){
					xtip.close(loadid);
					xtip.msg("我们已经发送说明邮件至邮箱:"+this.forgetdata.email+",请进入邮箱查阅",{icon:"s"});
				}else{
					xtip.close(loadid);
					xtip.msg(res.data.data,{icon:"e"});
				}
			})
		},
		forget:function () {
			xtip.msg("请点击左侧忘记密码按钮进行操作")
		}
	}
});
</script>
<!-- //script -->

</html>
